home *** CD-ROM | disk | FTP | other *** search
/ Komputer for Alle 2004 E…tra 100 Bedste Programmer / K-CD_2004_Ekstra_100_Gratis_Programmer.iso / Windows / X-Setup / xqdcXSP-Setup-EN.exe / {app} / plugins / XQ WinXP AutoPlay 10.xpl < prev    next >
Encoding:
XSetup plugin  |  2003-08-02  |  7.2 KB  |  265 lines

  1. "FILE"="Xteq Systems X-Setup Plugin 6.0"
  2. "TYPE"="8"
  3. "COUNT"="2"
  4. "UIPATH 1"="System\AutoPlay\Handler Assignment"
  5. "UIPATH 2"="System\AutoPlay\Audio CDs"
  6. "NAME"="Handler Assignment for AudioCDs"
  7. "OSVERSION"="0000011"
  8. "VERSION"="1.03"
  9. "LANGUAGE"="VBScript"
  10. "TEXT 1"="Show Info"
  11. "TEXT 2"="Enable/Disable"
  12. "DESCRIPTION 1"="When Windows detects a CD-ROM (or any other media) which does not contain an AUTORUN.INF normally needed for AutoPlay, Windows will check if there are any "handlers" available that can "handle" the contents of the CD-ROM.
  13. "DESCRIPTION 2"="For example, when you insert a Video-CD usually does not contain an AUTORUN.INF, Windows will check if there is one or more handlers registered to handle this Video-CD. If so, a window will pop up displaying the registered handlers so you can easily choose one. You can also select one of these handlers as the default selection for the current type of CD-ROM.
  14. "DESCRIPTION 3"="With this plug-in you can view which handlers are assign to the CD type and also change them. Click "Show Info" to see which command is executed when you select a handler or click "Enable/Disable" to activate or disable a handler. When you just have added a customer handler, you will find it at the end of the list as "X-Setup AutoPlay CustomHandlerX".
  15. "DESCRIPTION 4"="IMPORTANT: The AutoPlay window (where you can select one of the activated handlers) will _NOT_ show up if either a default handler is set, or only one handler is defined. 
  16. "DESCRIPTION 5"="To reset the list of default handlers, use the "Reset AutoPlay Default Handler Selection" plug-in inside the folder "Troubleshooting". 
  17. "AUTHOR"="Xteq Systems"
  18. "CONTACTURL"="http://www.xteq.com"
  19. "COPYRIGHT"="Copyright ⌐ Xteq Systems - All Rights Reserved"
  20. "COMMENT 1"=" "
  21.  
  22.  
  23. '/*** MAIN TEMPLATE IS THIS FILE ***/
  24. '/*** ONLY CHANGE REGISTRY KEYS BELOW ***/
  25.  
  26. C_CD_EVENT="PlayCDAudioOnArrival"
  27.  
  28.  
  29.  
  30.  
  31.  
  32. '/////////////////////////////////
  33. '///*** NO CHANGES BELOW HERE ***/
  34.  
  35. sP="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\" & C_CD_EVENT & "\"
  36.  
  37. XSET_GCHI_Name=""
  38. XSET_GCHI_EXE=""
  39.  
  40.  
  41. sPD1="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\"
  42.  
  43. sPClass="HKLM\Software\Classes\"
  44.  
  45. sInvoke1="\InvokeProgid"
  46. sInvoke2="\InvokeVerb"
  47.  
  48. sInvokeA="\ProgID"
  49. sInvokeB="\InitCmdLine"
  50.  
  51. Dim ary1()
  52. Dim ary2()
  53.  
  54. Dim iReadAllCount
  55.  
  56. sActive=" [ACTIVE] "
  57.  
  58.  
  59. Sub Plugin_Initialize 
  60.   iReadAllCount=0
  61.   Call ReloadAll
  62. End Sub
  63.  
  64. Sub ReloadAll
  65.  for i=1 to iReadAllCount
  66.      Call SetUIElement(i,"")
  67.  next 
  68.  
  69.  i1=0
  70.  i1=RegEnumValues(sP)
  71.  ReDim ary1(i1)
  72.  
  73.  i2=0
  74.  i2=RegEnumPaths(sPD1)
  75.  ReDim ary2(i2)
  76.  
  77.  Call ReadAll(sP)
  78.  Call ReadAllPaths(sPD1)
  79.  
  80.  
  81.  iReadAllCount=1
  82.  
  83.  for i=1 to i1
  84.      Call SetUIElement(iReadAllCount,sActive & ary1(i))
  85.      iReadAllCount=iReadAllCount+1
  86.  next
  87.  
  88.  for i=1 to i2
  89.      sName=ary2(i)
  90.      bExists=false
  91.  
  92.      'check if the handler already exists
  93.      for e=1 to i1
  94.          if sName=ary1(e) then
  95.             bExists=true
  96.             exit for
  97.          end if
  98.      next 
  99.  
  100.      if bExists=false then 
  101.         Call SetUIElement(iReadAllCount,ary2(i))
  102.         iReadAllCount=iReadAllCount+1
  103.      end if
  104.  next 
  105.  
  106. End Sub
  107.  
  108. Sub ReadAll(key)
  109.  iC=RegEnumValues(key)
  110.  if iC>0 then
  111.     for l=1 to iC
  112.         sName=RegEnumElement(l)
  113.         
  114.         ary1(l)=sName
  115.  
  116.         iReadAllCount=iReadAllCount+1
  117.     Next
  118.  end if
  119. End Sub
  120.  
  121.  
  122. Sub ReadAllPaths(key)
  123.  iC=RegEnumPaths(key)
  124.  if iC>0 then
  125.     for l=1 to iC
  126.         sName=RegEnumElement(l)
  127.         
  128.         ary2(l)=sName
  129.  
  130.         iReadAllCount=iReadAllCount+1
  131.     Next
  132.  end if
  133. End Sub
  134.  
  135.  
  136. Sub Plugin_CheckData(ElementIndex)
  137. End Sub
  138.  
  139. Sub Plugin_Apply(ElementIndex,ElementSubIndex)
  140.  if ElementSubIndex>0 then
  141.     sName=GetUIElement(ElementSubIndex)    
  142.     sRealName=""
  143.     bIsActivated=false
  144.     if InStr(sName,sActive)>0 then 
  145.        sRealName=ary1(ElementSubIndex)
  146.        bIsActivated=true
  147.     else 
  148.        sRealName=sName
  149.     end if
  150.     
  151.     if ElementIndex=1 then 
  152.        Call GetCommandNameAndExe(sRealName)
  153.  
  154.        Call MsgInformation("This item is called <" & XSET_GCHI_Name & "> and the command line that will be executed is <" & XSET_GCHI_Exe & ">")
  155.     else
  156.        if bIsActivated=true then
  157.           Call RegDeleteValue(sP & sRealName)
  158.           Call ReloadAll() 
  159.        else
  160.           Call RegWriteValue(sP & sRealName,"",1)
  161.           Call ReloadAll()
  162.        end if
  163.  
  164.     end if
  165.  end if
  166. End Sub
  167.  
  168. Sub GetCommandNameAndExe(HandlerID)
  169.  Dim sRegPath
  170.  sRegpath=sPD1 & HandlerID
  171.  
  172.  sProgID=RegReadValue(sRegPath & sInvoke1)
  173.  sVerb=RegReadValue(sRegPath & sInvoke2)
  174.  
  175.  '''Call DebugMsg("ProgID: " & sProgID)
  176.  '''Call DebugMsg("sVerb: " & sVerb)
  177.  
  178.  if len(sProgID)=0 then
  179.     sProgID=RegReadValue(sRegpath & sInvokeA)
  180.  end if 
  181.  
  182.  Call XSET_GetCOMHandlerInformation(sProgID,sVerb)
  183. End Sub
  184.  
  185.  
  186. Sub Plugin_Terminate 
  187. End Sub
  188.  
  189.  
  190. '*** Get COM Handler Information Version 1.0 ***
  191. '*** WARNING! Requires several global variables: ***
  192. '*** XSET_GCHI_Name -> Name of the command ***
  193. '*** XSET_GCHI_EXE  -> What will be executed ***
  194. Function XSET_GetCOMHandlerInformation(HandlerID,VerbID)
  195.  XSET_GCHI_Local_C_BasePath="HKLM\Software\Classes\"
  196.  XSET_GCHI_Local_C_CurVer="\CurVer\@"
  197.  
  198.  ''Call MsgInformation(HandlerID)
  199.  
  200.  'save the handlerID
  201.  XSET_GCHI_Local_Handler1=HandlerID
  202.  
  203.  'construct reg path 1
  204.  XSET_GCHI_Local_Reg1=XSET_GCHI_Local_C_BasePath & XSET_GCHI_Local_Handler1 & "\@"
  205.  XSET_GCHI_Local_RegHandler=XSET_GCHI_Local_C_BasePath & XSET_GCHI_Local_Handler1 & "\"
  206.  
  207.  'get the default name
  208.  XSET_GCHI_Local_Name1=RegReadValue(XSET_GCHI_Local_Reg1)
  209.  
  210.  'now check if there is a newer version available
  211.  XSET_GCHI_Local_Reg1=XSET_GCHI_Local_C_BasePath & HandlerID & XSET_GCHI_Local_C_CurVer
  212.  
  213.  'get the newer version (if any)
  214.  XSET_GCHI_Local_CurVer1=RegReadValue(XSET_GCHI_Local_Reg1)
  215.  
  216.  if IsEmpty(XSET_GCHI_Local_CurVer1)=false then
  217.     'damn it, there is a newer version available
  218.  
  219.     XSET_GCHI_Local_Handler1=XSET_GCHI_Local_CurVer1
  220.  
  221.     'construct reg path
  222.     XSET_GCHI_Local_Reg1=XSET_GCHI_Local_C_BasePath & XSET_GCHI_Local_Handler1 & "\@"
  223.     XSET_GCHI_Local_RegHandler=XSET_GCHI_Local_C_BasePath & XSET_GCHI_Local_Handler1 & "\"
  224.  
  225.     'read it 
  226.     XSET_GCHI_Local_Name2=RegReadValue(XSET_GCHI_Local_Reg1)
  227.  
  228.     'check the names...
  229.     if len(XSET_GCHI_Local_Name2)>0 then
  230.        XSET_GCHI_Local_Name1=XSET_GCHI_Local_Name2 
  231.     end if
  232.  end if
  233.  
  234.  'check if we have a name...
  235.  if len(XSET_GCHI_Local_Name1)=0 then
  236.     'Okay, we do not have a name...
  237.     XSET_GCHI_Local_Name1="COM:" & XSET_GCHI_Local_Handler1
  238.  end if
  239.  
  240.  '''Call MsgInformation(XSET_GCHI_Local_RegHandler)
  241.  
  242.  'save this name
  243.  XSET_GCHI_Name=XSET_GCHI_Local_Name1
  244.  
  245.  
  246.  
  247.  'now check for the Command
  248.  XSET_GCHI_Local_GetEXERegPath=XSET_GCHI_Local_C_BasePath & XSET_GCHI_Local_Handler1 & "\Shell\" & VerbID & "\command\@"
  249.  '''Call MsgInformation(XSET_GCHI_Local_GetEXERegPath)
  250.  XSET_GCHI_Local_GetEXE_Value=RegReadValue(XSET_GCHI_Local_GetEXERegPath)
  251.  if IsEmpty(XSET_GCHI_Local_GetEXE_Value)=false then
  252.     XSET_GCHI_EXE=XSET_GCHI_Local_GetEXE_Value
  253.  else
  254.     XSET_GCHI_EXE="UNKNOWN"
  255.  end if
  256.  
  257.  
  258.  ''Call MsgInformation("RES: " & XSET_GCHI_Local_Name1)
  259.  ''Call MsgInformation("CMD: " & XSET_GCHI_EXE)
  260. End Function
  261.  
  262.  
  263.  
  264.  
  265.